package com.xuanxing123.dao.hibernate;

import com.xuanxing123.dao.ModuleDao;
import com.xuanxing123.model.Module;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("moduleDao")
public class ModuleDaoHibernate extends GenericDaoHibernate<Module, Long> implements ModuleDao {

    public ModuleDaoHibernate() {
        super(Module.class);
    }

    /**
     * {@inheritDoc}
    */
    @SuppressWarnings("unchecked")
    public List<Module> getModulesByTypeId(Long productTypeId) {
        return getHibernateTemplate().find(
                "from Module where productType.id=? order by position", productTypeId);
    }
}
